package com.cly.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cly.domain.SysLog;
import com.cly.service.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "系统日志管理接口")
@RequestMapping("sys/log")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    @GetMapping("page")
    @ApiOperation("分页查询日志")
    @PreAuthorize("hasAuthority('sys:log:page')")
    public ResponseEntity<Page<SysLog>> sysLogPage(Page<SysLog> page, SysLog sysLog) {
        Page<SysLog> sysLogPage = sysLogService.findSysLogPage(page, sysLog);
        return ResponseEntity.ok(sysLogPage);
    }
}
